﻿Partial Public Class AuctionListing
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim db As New AuctionInfoDataContext
        Dim query
        If String.IsNullOrEmpty(Request.QueryString("cat")) Then
            query = From au In db.Auctions _
                    Select au.auctionID, au.title, au.subTitle, au.startingPrice, au.Images.First.imageID
        Else
            query = From au In db.Auctions _
                        Where au.Category.Name = Request.QueryString("cat") _
                        Select au.auctionID, au.title, au.subTitle, au.startingPrice, au.Images.First.imageID
        End If
        auctionList.DataSource = query
    End Sub

    Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        auctionList.DataBind()
    End Sub
End Class